import 'package:flutter/material.dart';
import 'package:flutterdemo/utils/img_util.dart';
import 'package:flutterdemo/utils/utils.dart';

class IconWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(
        title: Text("icon、image"),
      ),
      body: new Column(
        textDirection: TextDirection.ltr,
        children: <Widget>[
          new Row(
            children: <Widget>[
              Image(
                image: AssetImage(ImageUtil.getImgPath("icon_floor")),
                width: 70,
                height: 70,
              ),
              Image.asset(
                ImageUtil.getImgPath("icon_apple"),
                width: 70,
                height: 70,
              ),
              //加载网络图片
              Image.network(
                "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1592299623436&di=58d97de3879f20cf0b01c53cbc81dc75&imgtype=0&src=http%3A%2F%2Fa2.att.hudong.com%2F36%2F48%2F19300001357258133412489354717.jpg",
                width: 70,
                height: 70,
                fit: BoxFit.contain,
              ),
              IconButton(
                icon: Icon(Icons.favorite),
                color: Colors.redAccent,
                focusColor: Colors.greenAccent,
                splashColor: Colors.green,
                iconSize: 50,
                onPressed: null,
              ),
              ImageIcon(
                AssetImage(ImageUtil.getImgPath("icon_apple")),
                size: 40,
                color: Colors.green,
              ),
            ],
          ),
          new Row(
            children: <Widget>[
              Icon(
                Icons.print,
                size: 50,
                color: Colors.red,
              ),
              //Material Design文字图标
              Text(
                " \uE90D ",
                style: TextStyle(
                  fontFamily: "MaterialIcons",
                  fontSize: 50,
                  color: Colors.greenAccent,
                ),
              ),
              //自定义文字图标
            ],
          ),
          Container(
            color: Colors.black12,
            width: double.infinity,
            child: Wrap(
              spacing: 8.0, //主轴(水平)方向间距
              runSpacing: 4.0, //纵轴（垂直）方向间距
              alignment: WrapAlignment.start,
              children: <Widget>[
                //圆形图片
                ClipOval(
                  child: Image.asset(
                    ImageUtil.getImgPath("img_screen"),
                    width: 80,
                  ),
                ),
                CircleAvatar(
                  radius: 40,
                  backgroundImage: AssetImage(
                    ImageUtil.getImgPath("img_screen"),
                  ),
                ),
                Container(
                  width: 80,
                  height: 100,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    image: DecorationImage(
                      image: AssetImage(ImageUtil.getImgPath("img_screen")),
                    ),
                  ),
                ),
                ClipRRect(
                  borderRadius: BorderRadius.circular(12.0),
                  child: Image.asset(
                    ImageUtil.getImgPath("img_screen"),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
